/**
 * 直播分类业务操作
 */

const categoryModel = require('../models/category');
const categoryCode = require('../codes/category');

const category = {

	/**
	 * 增加分类
	 * @param  {object}
	 * @return {object|null}     查找结果
	 */
	async addCategory(formData, parentId) {
		let result = await categoryModel.addCategory(formData, parentId);
		return result;
	},

	/**
	 * 查询分类
	 * @param  {object}
	 * @return {object|null}     查找结果
	 */
	async getCategory(formData) {
		let result = await categoryModel.getCategory(formData);
		return result;
	},

	/**
	 * 更新分类
	 * @param  {object}
	 * @return {object|null}     查找结果
	 */
	async updateCategory(formData, id) {
		let result = await categoryModel.updateCategory(formData, id);
		return result;
	},

	/**
	 * 删除分类
	 * @param  {object}
	 * @return {object|null}     查找结果
	 */
	async deleteCategory(formData) {
		let result = await categoryModel.deleteCategory(formData);
		return result;
	},

	/**
	 * 查询热门分类
	 * @param  {object}
	 * @return {object|null}     查找结果
	 */
	async getHotCategory() {
		let result = await categoryModel.getHotCategory();
		return result;
	},
};

module.exports = category;